package com.zhiyou100.springbootmybatisplus.common;

/**
 * @Author anjingrz
 * @Version 1.0
 * @Description: TODO
 * @Date 2025-01-07 11:43
 */
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

    /**
     * @author
     *
     * 跨域访问配置
     */
    @Configuration
    public class CorsConfig implements WebMvcConfigurer {

        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
                    .allowedOrigins("*")
                    .allowCredentials(true)
                    .allowedMethods("GET", "POST", "DELETE", "PUT")
                    .maxAge(3600);
        }

    }



